package com.yztstudy.Service.Impl;

import com.yztstudy.Service.AdminOrderService;
import com.yztstudy.clients.OrderFeignClient;
import com.yztstudy.param.PageParam;
import com.yztstudy.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class AdminOrderServiceImpl implements AdminOrderService {

    @Resource
    private OrderFeignClient orderFeignClient; // 远程调用订单的服务

    /**
     * TODO 分页查询订单
     * @param pageParam 分页参数
     * @return
     */
    @Override
    public R orderList(PageParam pageParam) {

        // TODO 1.直接调用远程服务
        R result = orderFeignClient.adminList(pageParam);

        // TODO 2.日志记录
        if (result.getCode().equals(R.SUCCESS_CODE))
        {
            log.info("AdminOrderServiceImpl.orderList方法执行完毕,结果为:{}", "订单分页查询成功!");
        }else {
            log.info("AdminOrderServiceImpl.orderList方法执行完毕,结果为:{}", "订单分页查询失败!");
        }
        return result;
    }
}
